Building a Server Dashboard Application with ColdFusion-Powered Flex
Table of Contents
ColdFusion-Generated Flex
Earlier I compared ColdFusion rendering client-side HTML to Flex rendering client-side Flash. But the integration just explained is not really the same. When ColdFusion renders client-side HTML, for example, the CFML pages programmatically render the HTML, perhaps even embedding dynamic data at the same time. This is quite different from the integration described in the "ColdFusion as a Flex Back End," where ColdFusion does not generating client-side Flash, it simply provides data to Flash, generated by Flex.
So can you use ColdFusion to dynamically generate Flash apps in much the same way as it can HTML? Yes, it can, through the Flex JSP Tag Library interface. Flex comes with JSP tags which you can use inside of JSP pages. JSP tags are much like CFML tags, except that they are written in JSP instead of in CFML. With Flex JSP tags, developers programmatically embed Flex tags such as the Tree tags or the Grid tag in their JSP pages so that when a user requests a JSP URL, the generated page has Flash embedded within it.
How does this help ColdFusion developers? ColdFusion code can call JSP tags too. CFML
has a tag named <CFIMPORT> that developers use to import or include JSP tags; once
imported, developers can use these tags like any other ColdFusion tag.
To be able to do this, ColdFusion and Flex must be installed on the same J2EE server. While this installation process is not terribly difficult, it is a manual process. This obviously requires ColdFusion Enterprise, and will not work with a Standalone ColdFusion installation, since the Standalone ColdFusion installation does not expose a J2EE server that could run Flex.
Figure 4. Application flow for ColdFusion-generated Flex
Figure 4 shows the workflow:
- A user requests a ColdFusion CFML URL.
- ColdFusion imports the Flex JSP tags.
- ColdFusion generates a page, which contains both HTML and a Flex-generated SWF, which it sends to the client.
- The page displays in the user's browser; an embedded SWF executes in the user's Flash player.
This type of integration is best for dynamically-generated content, such as a dynamically-generated and populated tree control. This type of integration is less suitable for full-blown applications.